package ch10;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Arr3 {
    public static void main(String[] args) {
        //接上题，15名同学，用两个数组，一个存放姓名，一个存放成绩（string和int)
        Scanner in = new Scanner(System.in);
        int[] scores = new int[15];
        String[] names = new String[15];
        for (int i = 0; i < scores.length; i++) {
            System.out.print("请输入第" + (i + 1) + "位同学的姓名：");
            names[i] = in.next();
            System.out.print("请输入第" + (i + 1) + "位同学的成绩：");
            scores[i] = in.nextInt();
            while (true) {
                if (scores[i] < 0 || scores[i] > 100) {
                    System.out.println("重新输入");
                    scores[i] = in.nextInt();//重新来过
                }
                break;
            }
        }
        System.out.println("------------------------");
        System.out.println("姓名" + "\t\t\t" + "分数");
        for (int i = 0; i < scores.length; i++) {
            System.out.println(names[i] + "\t\t\t" + scores[i]);
        }
    }
}
